﻿$(document).ready(function(){
	$("#um_container > li a").click(function()
	{
		$("#um_container > li a").removeClass("um_hover")
		
		$(this).addClass("um_hover")
		//alert($(this).addClass("um_hover"));
	})
// 登录
	$("input[name=login]").click(function()
	{
		var username = $("#LoginForm_username").val()
		var password = $("#LoginForm_password").val()
		var data = {"username":username,"password":password}
		if(username && password)
		{
			$.ajax({
				url:"site/login",
				dataType:"text",
				type:"post",
				data:{"LoginForm":data},
				success:function(dataObj)
				{
					var data = eval("("+dataObj+")");

					if(data.sign==="success")
					{
						$(".sn_login").attr("href","profile/index").text(data.username)
						$(".sn_register").attr("href","site/logout").text("注销")
					}else{
						$("#LoginForm_password_em_").attr("style","display:block").text(data.errorCode)
						
					}
					
				}
			})
		}
	})
})
